<?php

/**
 * This is the model class for table "{{reportrule}}".
 *
 * The followings are the available columns in table '{{reportrule}}':
 * @property double $id
 * @property string $code
 * @property string $name
 * @property string $cityname
 * @property string $remark
 * @property double $add_time
 * @property double $create_user
 * @property double $create_time
 * @property double $update_user
 * @property double $update_time
 * @property double $is_del
 */
class Reportrule extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Reportrule the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{reportrule}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('add_time, create_user, create_time, update_user, update_time, is_del', 'numerical'),
			array('code', 'length', 'max'=>20),
			array('name', 'length', 'max'=>50),
			array('cityname', 'length', 'max'=>100),
			array('remark', 'length', 'max'=>255),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, code, name, cityname, remark, add_time, create_user, create_time, update_user, update_time, is_del', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'code' => 'Code',
			'name' => 'Name',
			'cityname' => 'Cityname',
			'remark' => 'Remark',
			'add_time' => 'Add Time',
			'create_user' => 'Create User',
			'create_time' => 'Create Time',
			'update_user' => 'Update User',
			'update_time' => 'Update Time',
			'is_del' => 'Is Del',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('code',$this->code,true);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('cityname',$this->cityname,true);
		$criteria->compare('remark',$this->remark,true);
		$criteria->compare('add_time',$this->add_time);
		$criteria->compare('create_user',$this->create_user);
		$criteria->compare('create_time',$this->create_time);
		$criteria->compare('update_user',$this->update_user);
		$criteria->compare('update_time',$this->update_time);
		$criteria->compare('is_del',$this->is_del);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}